#include "tester.h"

string Tester::opcodeToStr(const Opcode *opcode) {
	switch (opcode->ir) {
		case 0x00:
			return "NOP";
			break;
		case 0x01:
			return "CLS";
			break;
		case 0x02:
			return "VBLNK";
			break;
		case 0x03:
			return "BGC N";
			break;
		case 0x04:
			return "SPR HHLL";
			break;
		case 0x05:
			return "DRW RX, RY, HHLL";
			break;
		case 0x06:
			return "DRW RX, RY, RZ";
			break;
		case 0x07:
			return "RND RX, HHLL";
			break;
		case 0x08:
			return "FLIP";
			break;
		case 0x09:
			//SND0();	
			break;
		case 0x0A:
			//SND1HHLL();
			break;
		case 0x0B:
			//SND2HHLL();
			break;
		case 0x0C:
			//SND3HHLL();
			break;
		case 0x0D:
			//SNPRxHHLL();
			break;
		case 0x0E:
			//SNGADVTSR();
			break;
		case 0x10:
			return "JMP HHLL";
			break;
		case 0x12:
			return "Jx HHLL";
			break;
		case 0x13:
			return "JME RX, RY, HHLL";
			break;
		case 0x16:
			return "JMP RX";
			break;
		case 0x14:
			return "CALL HHLL";
			break;
		case 0x15:
			return "RET";
			break;
		case 0x17:
			return "Cx HHLL";
			break;
		case 0x18:
			return "CALL RX";
			break;
		case 0x20:
			return "LDI RX, HHLL";
			break;
		case 0x21:
			return "LDI SP, HHLL";
			break;
		case 0x22:
			return "LDM RX, HHLL";
			break;
		case 0x23:
			return "LDM RX, RY";
			break;
		case 0x24:
			return "MOV RX, RY";
			break;
		case 0x30:
			return "STM RX, HHLL";
			break;
		case 0x31:
			return "STM RX, RY";
			break;
		case 0x40:
			return "ADDI RX, HHLL";
			break;
		case 0x41:
			return "ADD RX, RY";
			break;
		case 0x42:
			return "ADD RX, RY, RZ";
			break;
		case 0x50:
			return "SUBI RX, HHLL";
			break;
		case 0x51:
			return "SUB RX, RY";
			break;
		case 0x52:
			return "SUB RX, RY, RZ";
			break;
		case 0x53:
			return "CMPI RX, HHLL";
			break;
		case 0x54:
			return "CMP RX, RY";
			break;
		case 0x60:
			return "ANDI RX, HHLL";
			break;
		case 0x61:
			return "AND RX, RY";
			break;
		case 0x62:
			return "AND RX, RY, RZ";
			break;
		case 0x63:
			return "TSTI RX, HHLL";
			break;
		case 0x64:
			return "TST RX, RY";
			break;
		case 0x70:
			return "ORI RX, HHLL";
			break;
		case 0x71:
			return "OR RX, RY";
			break;
		case 0x72:
			return "OR RX, RY, RZ";
			break;
		case 0x80:
			return "XORI RX, HHLL";
			break;
		case 0x81:
			return "XOR RX, RY";
			break;
		case 0x82:
			return "XOR RX, RY, RZ";
			break;
		case 0x90:
			return "MULI RX, HHLL";
			break;
		case 0x91:
			return "MUL RX, RY";
			break;
		case 0x92:
			return "MUL RX, RY, RZ";
			break;
		case 0xA0:
			return "DIVI RX, HHLL";
			break;
		case 0xA1:
			return "DIV RX, RY";
			break;
		case 0xA2:
			return "DIV RX, RY, RZ";
			break;
		case 0xB0:
			return "SHL RX, RZ";
			break;
		case 0xB1:
			return "SHR RX, RZ";
			break;
		case 0xB2:
			return "SAR RX, RZ";
			break;
		case 0xB3:
			return "SHL RX, RY";
			break;
		case 0xB4:
			return "SHR RX, RY";
			break;
		case 0xB5:
			return "SAR RX, RY";
			break;
		case 0xC0:
			return "PUSH RX";
			break;
		case 0xC1:
			return "POP RX";
			break;
		case 0xC2:
			return "PUSHALL";
			break;
		case 0xC3:
			return "POPALL";	
			break;
		case 0xC4:
			return "PUSHF";
			break;
		case 0xC5:
			return "POPF";
			break;
		case 0xD0:
			return "PAL HHLL";
			break;
		case 0xD1:
			return "PAL RX";
			break;
	}

	return "Undefined";
}